#!/usr/bin/env python
# -*- coding: utf-8 -*- 
#############################################################################
# GMangas
# Copyright (C) 2008  Ferraro Luciano (aka Lux) <luciano.ferraro@gmail.com>
# 
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
############################################################################

import pygtk
pygtk.require("2.0")
import gtk

import webbrowser

gtk.about_dialog_set_url_hook(lambda a,b,c: webbrowser.open(b), None)
gtk.about_dialog_set_email_hook(lambda a,b,c: webbrowser.open(b), None)

class Main(gtk.AboutDialog):
    def __init__(self, core, main):
        gtk.AboutDialog.__init__(self)
        self.main = main

        self.set_name("GMangas")
        self.set_version(main['__version__'])
        self.set_copyright(main['__copyright__'])
        self.set_license( main['__license__']() )
        self.set_comments("♥♥♥\n" + _("""Gmangas is a free, OpenSource, mangas reader founded by Luciano Ferraro.
You can read hundreds mangas without download anything, and you could even create a BackEnd for your favourite Mangas site!"""))
        self.set_wrap_license(False)
        self.set_website(main['__url__'])
        self.set_website_label("GMangas's website")
        self.set_authors( main['__authors__']() )
        try:
            self.set_program_name(main['__buildname__'])
        except:
            pass

        self.connect('response', self.close)

    def close(self, widget, event):
        if event == gtk.RESPONSE_CANCEL:
            self.hide()

    def run(self, widget):
        gtk.AboutDialog.run(self)
